16. Clustering Columns

10 Clustering Columns -

Clustering Columns:

  • The clustering column will sort the data in sorted ascending order, e.g., alphabetical order. Note: this is a mistake in the video, which says descending order.
  • More than one clustering column can be added (or none!)
  • From there the clustering columns will sort in order of how they were added to the primary key

Commonly Asked Questions:

How many clustering columns can we add?

You can use as many clustering columns as you would like. You cannot use the clustering columns out of order in the SELECT statement. You may choose to omit using a clustering column in your SELECT statement. That's OK. Just remember to use them in order when you are using the SELECT statement.

Additional Resources:

  1. Here is the DataStax documentation on Composite Partition Keys.
  2. This Stackoverflow page provides a nice description of the difference between Partition Keys and Clustering Keys.

The PRIMARY KEY is made up of…

SOLUTION: The partition key and the clustering columns

A Clustering Column is required in the Primary Key

SOLUTION: False